<?php
namespace app\common\model;

use think\Model;

class BisAccount extends BaseModel
{

    public function updateById($data, $id) {
        // allowField 过滤data数组中非数据表中的数据
        return $this->allowField(true)->save($data, ['id'=>$id]);
    }

    public function getNormalAccountByBisId($bisId){
        $data = [
            'bis_id' => $bisId,
            'status' => 0,
            'is_main'=>1,
        ];
        $result = $this->where($data)
            ->order('id', 'desc')
            ->find();
        return $result;
    }

    public function getNormalAccountByBisIdWith($bisId){
        $data = [
            'bis_id' => $bisId,
            'is_main'=>1,
        ];
        $result = $this->where($data)
            ->order('id', 'desc')
            ->find();
        return $result;
    }
}